import { backPack } from "./backpack/backPack";

export type ItemRemoveRecord = {
    itemID: string,
    isRemoveGameObject: boolean,
}

export class User {

    name: string = "";

    // keys: string[] = ["ironKey","bag","candle1","candle2","crazyWord","diary","fire","gun","knife","noteMan"];
    // keys: string[] = ["E","crazyWord","ironKey","knife","candle1","gun","bag"];
    keys: string[] = [];

    mind: number = 100; //精神值

    sceneRecords: string[] = []; //记录进入场景的路径

    itemRemoveRecord: ItemRemoveRecord[] = [];  //记录场中中已经消失的物品

    hiddenClueItemRecord: string[] = [];

    useBagItems: string[] = []; //记录已经使用过的背包中物品

    firstInStartScene: boolean = true;

    limitedTimeMission: number = 0;

    addSceneRecord(scene: string) {
        for (let sceneRecord of this.sceneRecords) {
            if (sceneRecord == scene) {
                return; //避免重复输入同一个场景地址
            }
        }
        // this.sceneRecord.push(scene);
        this.sceneRecords.unshift(scene);   //将进入的场景地址放在第一位
        console.log(this.sceneRecords);
    }

    addItemRemoveRecord(currentitemID: string, currentisRemoveGameObject: boolean) {
        const record = { itemID: currentitemID, isRemoveGameObject: currentisRemoveGameObject };
        this.itemRemoveRecord.push(record);
        console.log("被移除的物品：",this.itemRemoveRecord);
    }

}


export const user = new User();
backPack.objsInBackPack = user.keys;